

import os
from urllib.parse import unquote


a=[]
with  open("123.pcapng", "rb") as f:
    for i in f.readlines():
        tmp=unquote(i.strip())
        if "security.flag ORDER BY flag LIMIT" in tmp or  "2d2" in tmp or "2c2" in tmp:
            a.append(tmp)

a2=[]
for i in range(0,len(a)):
    if "flag" in a[i]:
        tmp1=a[i]+a[i+1]
        a2.append(tmp1)
        print(tmp1)
import re

a1={}
for i in a2:
    try:
        tmp=re.search(r"flag LIMIT 0,1\),(\d+),1\)\)>(\d+) AND \'lKqs\'\=\'lKqs HTTP\/1\.1(2.2)",i)
        tmp3=[tmp[2],tmp[3]]
        print(tmp3)
        a1[tmp[1]]=tmp3
    except:
        continue

flag=""
for i in a1:
    tmp=a1[i][1]
    if tmp=="2d2":
        flag+=chr(int(a1[i][0]))
    else:
        flag += chr(int(a1[i][0])+1)
    print(flag)
print(flag)
